<div class="da-list-wrap">
  <div class="da-content-banner">
    <d-breadcrumb>
      <d-breadcrumb-item><a routerLink="/">{{ 'product.breadcrumb.home' | translate }}</a></d-breadcrumb-item>
      <d-breadcrumb-item>{{ 'product.breadcrumb.productJobPink' | translate }}</d-breadcrumb-item>
    </d-breadcrumb>
  </div>
  <div class="da-content-wrapper">
    <div class="da-list-container ">
      <div class="da-list-header">
        <div class="d-input">
          <div class="inputIn">
            <input dTextInput style="width: 180px;" [error]="false" placeholder="单据编码" name="filterRole" class="me-2"
              [(ngModel)]="jobOrderIssueNum">
            <d-range-datepicker-pro [(ngModel)]="rangeDate" (ngModelChange)="rangeDateChange($event)" name="rangeDate"
              [placeholder]="['制单时间-开始','制单时间-结束']" class="me-2"></d-range-datepicker-pro>
            <div class="d-submit">
              <d-button id="primaryBtn" (click)="search()"><i class="icon icon-filter-o me-2"></i>查询</d-button>
              <d-button bsStyle="common" (click)="reset()"> <i class="icon icon-refresh me-2"></i>重置</d-button>
            </div>
          </div>

        </div>
        <div class="btn-group">
          <div class="btn-left">
            <d-button bsstyle="primaryBtn" routerLink="/pages/product/add-picking-list">发料单—制单</d-button>
            <d-button bsStyle="common" (btnClick)="GetLogs()">日志</d-button>
          </div>
        </div>
      </div>
      <div class="list-content">
        <d-data-table [dataSource]="tableData" [lazy]="true" [scrollable]="true" [fixHeader]="true"
          [tableWidthConfig]="tableWidthConfig" [tableOverflowType]="'auto'" [scrollable]="true"
          (checkAllChange)="getCheckedRows()" (rowCheckChange)="getCheckedRows()" [resizeable]="true">
          <thead dTableHead [checkable]="true">
            <tr dTableRow>
              <th dHeadCell [fixedLeft]="'80px'">
                <span>操作</span>
              </th>
              <th dHeadCell [fixedLeft]="colOption.fixedLeft" *ngFor="let colOption of dataTableOptions.columns"
                [title]="colOption.header">{{colOption.header}}</th>
            </tr>
          </thead>
          <tbody dTableBody>
            <ng-template let-rowItem="rowItem" let-rowIndex="rowIndex" let-nestedIndex="nestedIndex">
              <tr>
                <td dTableCell [fixedLeft]="'0px'">
                  <d-checkbox [disabled]="false" [showAnimation]="true" [ngModelOptions]="{ standalone: true }"
                    [ngModel]="rowItem.$checked && (rowItem.$checked || rowItem.$halfChecked)" dTooltip
                    [showGlowStyle]="false"></d-checkbox>
                </td>
                <td dTableCell  [fixedLeft]="'80px'">
                  <!-- <span class="me-2"><a class="devui-link">审核</a></span> -->
                  <span class="me-2"><a class="devui-link" (click)="detailed(rowItem.jobOrderIssueId)">查看</a></span>
                  <span class="me-2"><a  (click)="chuku(rowItem.jobOrderIssueId)" class="devui-link" [class.disabled]="rowItem.status !=='审核通过' || rowItem.isIssue">出库</a></span>
                  <span class="me-2"><a class="devui-link" (click)="edit(rowItem.jobOrderIssueId)"   [class.disabled]="rowItem.status =='审核通过' || rowItem.isIssue">编辑</a></span>
                  <span class="me-2" ><a (click)="isAudit(rowItem)" class="devui-link" [class.disabled]="rowItem.status =='审核通过' || rowItem.isIssue">审核</a></span>
                  <span class="me-2" ><a (click)="disAudit(rowItem)" class="devui-link"   [class.disabled]="rowItem.status =='审核不通过' || rowItem.isIssue">审核不通过</a></span>
                  <span class="me-2" ><a (click)="delete(rowItem.jobOrderIssueId)"
                      class="devui-link-danger" [class.disabled]="rowItem.isAudit">删除</a></span>
                </td>
                <td dTableCell [fixedLeft]="'230px'">
                  <span dTooltip [content]="rowItem.jobOrderIssueNum">{{rowItem.jobOrderIssueNum}}</span>
                </td>

                <td dTableCell>
                  <span dTooltip [content]="rowItem?.isIssue | booleanToText:'已出库':'未出库'">
                    <d-tag [tag]="rowItem?.isIssue | booleanToText:'已出库':'未出库'" [labelStyle]="rowItem?.isIssue"></d-tag>
                  </span>
                </td>
                <td dTableCell>
                  <span dTooltip [content]="rowItem?.status">
                    <d-tag [tag]="rowItem?.status " [labelStyle]="rowItem?.status"></d-tag>
                  </span>
                </td>
                <td dTableCell [rowItem]="rowItem" [field]="'showType'">
                  <span>
                    <div dImagePreview>
                      <d-badge *ngIf="rowItem.qrCodePath" [count]="getImagesArray2(rowItem.qrCodePath).length"
                        status="success">
                        <ng-container *ngFor="let imageUrl of getImagesArray2(rowItem.qrCodePath); let i = index">
                          <img *ngIf="getImagesArray2(rowItem.qrCodePath).length > 0" [src]="imageUrl" alt="图片"
                            height="22px" [ngStyle]="{'display': i === 0 ? 'block' : 'none'}" />
                        </ng-container>
                      </d-badge>
                    </div>
                  </span>
                </td>
                <td dTableCell>
                  <span dTooltip [content]="rowItem.creatorName">{{rowItem.creatorName}}</span>
                </td>
                <td dTableCell>
                  <span dTooltip [content]="rowItem.createTime">{{rowItem.createTime}}</span>
                </td>
                <td dTableCell>
                  <span (click)="GetLogById(rowItem)"><a class="devui-link">查看</a></span>
                </td>
                <!-- <td dTableCell  >
                      <span>审核人</span>
                    </td>
                    <td dTableCell  >
                      <span>审核日期</span>
                    </td> -->
              </tr>
            </ng-template>
          </tbody>
        </d-data-table>
      </div>
      <div class="page-footer">
        <div>
          <p>已选 <span class="underline">{{checkedIds.length}}</span> 条
            <a (click)="cleared()" class="clear">清空</a>
          </p>
        </div>
        <d-pagination [size]="'sm'" [canViewTotal]="true" [canChangePageSize]="true" [canJumpPage]="true" [maxItems]="5"
          [total]="this.pager.total" [pageSizeOptions]="this.pageSizeOptions" [(pageSize)]="pager.pageSize"
          [(pageIndex)]="pager.pageIndex" (pageIndexChange)="pageIndexChange($event)"
          (pageSizeChange)="pageSizeChange($event)">
        </d-pagination>
      </div>
    </div>
  </div>
</div>
<d-toast [value]="msgs" [life]="2000" [styleClass]="'custom-class'" [style]="{ left: '50%',top:'10px' }"></d-toast>
